{% extends "layout.html" %}

{% block title %}Création achat mobile {% endblock %}

{% block content %}
<script type="text/javascript"><!--
var lastDiv = "";
function showDiv(divName) {
	// hide last div
	if (lastDiv) {
		document.getElementById(lastDiv).className = "hiddenDiv";
	}
	//if value of the box is not nothing and an object with that name exists, then change the class
	if (divName && document.getElementById(divName)) {
		document.getElementById(divName).className = "visibleDiv";
		lastDiv = divName;
	}
}
//-->
</script>
<style type="text/css" media="screen"><!--
.hiddenDiv {
	display: none;
	}
.visibleDiv {
	display: block;
	}

--></style>
<form method="post" class="form-horizontal" >

	<div class="row">
	<div class="span11">
	<a href="achat-option-fixe" class="btn btn btn-primary"><i class="icon-plus-sign icon-white"></i> Voir la liste </a>
	  <fieldset>
		<legend align="center">Nouvel Achat d'Option Fixe</legend>
	  </fieldset>
    </div>
	 <!-- Première colonne -->
	<div class="span5">
    
	  <fieldset>
	
	<div class="control-group">
			<label class="control-label" for="type">Type</label>
			<div class="controls">
			   <select name="type" size="1" onchange="showDiv(this.value);"/>
	           	<option value="">Selectionnez...</option>
	           	{% if not(session.niveauAuth=='2')and not(session.niveauAuth=='4')and not(session.niveauAuth=='6')and not(session.niveauAuth=='7')and not(session.niveauAuth=='9') %}
				  <option value="vga" {% if offre.type == "vga" %}selected{% endif %}>VGA</option>
				   <option value="vga/num" {% if offre.type == "vga/num" %}selected{% endif %}>VGA numeris</option>
				   {% endif %}
				   {% if not(session.niveauAuth=='2')and not(session.niveauAuth=='4')and not(session.niveauAuth=='5')and not(session.niveauAuth=='6')and not(session.niveauAuth=='7')and not(session.niveauAuth=='8')and not(session.niveauAuth=='9') %}
				  <option value="voip" {% if offre.type == "voip" %}selected{% endif %}>VOIP</option>
				  <option value="xdsl" {% if offre.type == "xdsl" %}selected{% endif %}>Xdsl</option>
				  {% endif %}
	              <option value=""> </option>
	
				</select>
			</div>
		  </div>
	
      <div class="control-group">
		<label class="control-label" for="code_artice">Code article</label>
        <div class="controls">
		<div class="input-prepend">
		   <input name="code_article" type="text" value=""/> 
		</div>
	  </div>
	  </div>
      
	  <div class="control-group">
		<label class="control-label" for="nom">Nom </label>
        <div class="controls">
		<div class="input-prepend">
		   <input name="nom" type="text" value=""/> 
		</div>
	  </div>
	  </div>
      
	
    <div class="control-group">
		<label class="control-label" for="nom">Incompatibilité </label>
        <div class="hiddenDiv" id="vga/num">
		   {% for offre_vga_num in offres_vga_num %}
           <div class="controls">
           <input name="incompatibilite[]" type="checkbox" value="{{offre_vga_num.id}}"/> {{offre_vga_num.nom}}<br>
           </div> 
           {% endfor %}
	  	</div>
        <div class="hiddenDiv" id="vga">
		   {% for offre_vga in offres_vga %}
           <div class="controls">
           <input name="incompatibilite[]" type="checkbox" value="{{offre_vga.id}}"/> {{offre_vga.nom}}<br> 
           </div>
           {% endfor %}
	  	</div>
        <div class="hiddenDiv" id="voip">
		   {% for offre_voip in offres_voip %}
           <div class="controls">
           <input name="incompatibilite[]" type="checkbox" value="{{offre_voip.id}}"/> {{offre_voip.nom}}<br>
           </div> 
           {% endfor %}
	  	</div>
        <div class="hiddenDiv" id="xdsl">
		   {% for offre_xdsl in offres_xdsl %}
           <div class="controls">
           <input name="incompatibilite[]" type="checkbox" value="{{offre_xdsl.id}}"/> {{offre_xdsl.nom}}<br>
           </div> 
           {% endfor %}
	  	</div>
	  </div>

{% if offre.type != 'xdsl' %}        
	<div class="control-group">
    <label class="control-label" for="temps_min">TEMPS</label>
        <div class="controls">
            <div class="input-prepend">
            <input name="temps_min" type="text" value="{{offre_choisie.0.temps_min}}" /> 
            </div>
        </div>
    </div>      
      <div class="control-group">
		<label class="control-label" for="prix_ha">Prix d'achat </label>
		<div class="controls">
		   <input name="prix_ha" type="text" value=""/> 
		</div>
	  </div>

<div class="control-group">
			<label class="control-label" for="horaires">Horaires</label>
			<div class="controls">
			   <select name="horaires" size="1" />
	           	<option value="">Selectionnez...</option>
				  <option value="24/24" {% if offre_choisie.0.horaires == "24/24" %}selected{% endif %}>24h sur 24</option>
				  <option value="8/19" {% if offre_choisie.0.horaires == "8/19" %}selected{% endif %}>8h Ã  19h</option>
	              <option value=""> </option>
	
				</select>
			</div>
		  </div>
          	
	      <div class="control-group">
			<label class="control-label" for="jours">Jours</label>
		<div class="controls">
			   <select name="jours" size="1" />
	           	<option value="">Selectionnez...</option>
				  <option value="7/7" {% if offre_choisie.0.jours == "7/7" %}selected{% endif %}>7 jours sur 7</option>
				  <option value="5/7" {% if offre_choisie.0.jours == "5/7" %}selected{% endif %}>5 jours sur 7</option>
	              <option value=""> </option>
	
				</select>
			</div>
		  </div>
     <div class="control-group">
   <label class="control-label">Type de forfait</label>
      	<div class="controls">
      		<label class="checkbox inline" for="fixe">
     			<input type="checkbox" id="fixe" name ="fixe" value="x" {% if offre_choisie.0.fixe == "x" %}checked{% endif %}> Fixe
 			</label>
			<label class="checkbox inline"for="mobile">
  				<input type="checkbox" id="mobile" name ="mobile" value="x" {% if offre_choisie.0.mobile == "x" %}checked{% endif %}> Mobile
			</label>
		</div>  
	  </div>

	
    <div class="control-group">
			<label class="control-label" for="pays">International</label>
			<div class="controls">
			   <select name="pays" size="1" />
	           	<option value="">Selectionnez...</option>
                {% for pays in pays %}
				<option value="{{pays.id}}" >{{pays.nom}}</option>
				{% endfor %}
				</select>
			</div>
		  </div>      	
{% else %}
    			<input name="temps_min" type="hidden" value=""/> 
                <input name="jours" type="hidden" value=""/> 
                <input name="horaires" type="hidden" value=""/> 
                <input name="fixe" type="hidden" value=""/> 
                <input name="mobile" type="hidden" value=""/> 
                <input name="pays" type="hidden" value=""/> 
{% endif %}  	  

	</fieldset>

	</div>
	</div>
	
	
		<div class="form-actions">
		<span>Action après validation</span>
		<br/>
		  <select name="action">
			<option value="achat-option-fixe">Afficher la liste </option>
			<!--<option value="">Créer une commande pour un client</a></option>-->
			<option value="achat-option-fixe-creation">Saisir une nouvelle offre</option>
		  </select>
		<br/><br/>
         
		<button type="submit" class="btn btn-primary" name="creation">Création</button>
        <button type="reset" class="btn " name="annuler">Annuler</button>
        
		</div>

	
</form>

{% endblock %}
	
